<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue@next"></script>
  <style>
    .active {
      color: red;
    }
  </style>
</head>
<body>
  <div id="app">
    <todo-list>
      <template v-slot:default="slotProps">
        <span class="green">{{ slotProps.index }}：{{ slotProps.item }}</span>
      </template>
    </todo-list>
    <todo-list v-slot:default="slotProps">
      <span class="green">{{ slotProps.index }}：{{ slotProps.item }}</span>
    </todo-list>
    <todo-list #default="{ item = 'placeholder', index }">
      <span class="green">{{ index }}：{{ item }}</span>
    </todo-list>
  </div>

  <script>
    const app = Vue.createApp({})

    app.component('todo-list', {
      setup() {
        const items = Vue.reactive(['cat', 'milk'])
        return { items }
      },
      template: `
      <div class="container">
        <p v-for="(item, index) in items" :key="item">
          <slot :item="item" :index="index"></slot>
        </p>
      </div>
      `
    })
    app.mount('#app')
  </script>
</body>
</html>